package com.student.liu.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.student.liu.entity.Reimbursement;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

public interface IReimbursementMapper extends BaseMapper<Reimbursement> {

    @Select("select reimbursement.id as 'id', reimbursement.name as 'name',realname,producetime, reimbursetime,reason, money, dispose_reason," +
            "reimbursement_category.name as 'category', reimbursement_state.name as 'state' ,process_instance_id from reimbursement " +
            "inner join user on reimbursement.user_id=user.id " +
            "inner join reimbursement_state on reimbursement.state_id=reimbursement_state.id " +
            "inner join reimbursement_category on reimbursement.category_id=reimbursement_category.id " +
            "${ew.customSqlSegment}")
    Map<String, Object> getReimbursementJoinUser(@Param("ew") Wrapper queryWrapper);

    @Select("select reimbursement.id as 'id', reimbursement.name as 'name',realname,producetime, reimbursetime,reason, money, dispose_reason," +
            "reimbursement_category.name as 'category', reimbursement_state.name as 'state' ,process_instance_id from reimbursement " +
            "inner join user on reimbursement.user_id=user.id " +
            "inner join reimbursement_state on reimbursement.state_id=reimbursement_state.id " +
            "inner join reimbursement_category on reimbursement.category_id=reimbursement_category.id " +
            "${ew.customSqlSegment}")
    IPage<Map<String, Object>> pageReimbursementJoinUser(Page page, @Param("ew") Wrapper queryWrapper);

}
